{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/fibonacci-number\n",
    "\n",
    "\n",
    "\n",
    "Runtime: 4 ms, faster than 36.65% of C++ online submissions for Fibonacci Number.\n",
    "Memory Usage: 5.8 MB, less than 94.10% of C++ online submissions for Fibonacci Number.\n",
    "\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <vector>\n",
    "#include <algorithm>\n",
    "#include <iostream>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    int fib(int n) {\n",
    "        //4:41\n",
    "        if (n == 0) {return 0;}\n",
    "        vector<int> arr = {0,1};\n",
    "        int i = 2;\n",
    "        while (i<n) {\n",
    "            int newValue = arr[arr.size()-2] + arr[arr.size()-1];\n",
    "            arr.push_back(newValue);\n",
    "            i += 1;\n",
    "        }\n",
    "        return arr[arr.size()-2] + arr[arr.size()-1];\n",
    "        //4:47\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
